/*
* ============================================================================
*  Name        : sea_types.h
*  Part of     : Finite state machine framework
*  Description : 
*  Version     : %version: %
*  
*
* ============================================================================
*/
/**
 * @file sea_types.h
 *
 * @ingroup StateMachineFramework
 */
#if !defined( __sea_types_h__ )
#define __sea_types_h__

/**
 * SEA API namespace
 */
namespace sea
{
    /**
     * Internal namespace for basic types to avoid the clash with
     * hosting applicattion types
     */
    namespace i
    {
        typedef char int8;
        typedef short int16;
        typedef int int32;
        typedef long long int64;
        typedef unsigned char uint8;
        typedef unsigned short uint16;
        typedef unsigned int uint32;
        typedef void* any;
        typedef int Index;
        typedef int Offset;
    }

    #undef NULL
    #define NULL 0

    /**
     * @enum Error
     * @brief Error codes
     */
    enum Error
    {
        eFailed = -1,
        eOk  = 0,
        eStateMachineNotCreated,
        eOutOfMemory,
        eCompileError,
        eParentNotPresent,
        eManagerNotPresent,
        eExecModeError,
        eDispatcherReEntry,
        eMachineIsDead,
        eWrongThreadContext,
        eWaitFailed,
        eStateMachineNotActive,
        eWrongParameter,
        eStateMachineIsAlreadyActive,
        eManagerDoesNotHaveStateMachines,
        eCreateStateMachineFirst,
        eStartStateMachineFirst,

        eParserNoHostingSm,
        eParserWrongMetaData,
        eParserCannotOpenFile,
        eParserFileReadError,
        eParserEmtpySourceCode,
        eParserUnknownSourceType,
        eParserInvalidInitialStateIndex,
        eParserActionListEmpty,
        eParserEventListEmpty,
        eParserUnknownSystemEvent,
        eParserUnknownSystemAction,
        eParserUnknownEvent,
        eParserUnknownAction,
        eParserUnknownState,
        eParserUnknownStateMachine,
        eParserUnknownExecMode,
        eParserWrongCoutingStateParams,
    };

    /**
     * @enum Relationship
     * @brief Relationships in sea namespace 
     */
    enum Relationship
    {
        EngineManager = 0x00000001,     ///< Engine <-> Manager
        ManagerStateMachine,            ///< Manager <-> State machine
        StateMachineBody,               ///< State machine <-> body/prototype
        ParentChild,                    ///< Parent state machine <-> child state machine
        StateMachineEvent,              ///< State machine <-> Event

        Attribute = 0x80000000,         ///< Attribute/quality/property
    };

    /**
     * @enum Relationship search direction
     * @brief It is up to application to interpret the meaning <br>
     * Example: Parent -> child, Before -> After, Hierarchy, etc.
     */
    enum Direction
    {
        Neither,                        ///< Undefined 
        Right,                          ///< Association on the right/Down
        Left,                           ///< Association on the left/Up
        Either                          ///< Either way. Needed for Vertical iterator, while going through polygamy
                                        ///< associations
    };

    /**
     * @enum OsThreadPriority
     * @brief Cross platform thread priority gradation
     */
    enum OsThreadPriority
    {
        Lowest,     
        Lower,
        Normal,
        Higher,
        Highest
    };

    /**
     * Event identifier
     */
    typedef int EventId;

    /**
     * Generic callbacks
     */
    typedef void ( *Callback )( void* );
    typedef void ( *TimerCallback )( void*, bool );

    /**
     * State machine compiler types
     */
    typedef char* SourceCode;
    typedef int* BinCode;
}

#endif // #if !defined( __sea_types_h__ )
